home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 5 / BBS in a Box -Volume V (BBS in a Box) (April 1992).iso / Files / Apple / Apple II TNs(Text).cpt / Apple II TNs(Text) / IIGS / TN.IIGS.050 < prev    next >
Encoding:
Text File  |  1989-11-15  |  2.5 KB  |  55 lines  |  [TEXT/pdos]

  1. Apple II
  2. Technical Notes
  3. _____________________________________________________________________________
  4.                                                   Developer Technical Support
  5.  
  6. Apple IIGS
  7. #50:    Extended Serial Interface Error Handling
  8.  
  9. Written by:    Dan Strnad                                        January 1989
  10.  
  11. This Technical Note discusses error reporting by the Extended Serial 
  12. Interface.
  13. _____________________________________________________________________________
  14.  
  15. For Apple IIGS ROM 01, the Extended Serial Interface does not return the error 
  16. condition in the carry bit.  Programs using the Extended Serial Interface 
  17. should check for a non-zero result value in the result code rather than the 
  18. carry bit to determine if an error has occurred.  The following eight-bit APW 
  19. code demonstrates this error checking using the SetDTR command.  The SetDTR 
  20. routine zeros the result bytes if no error has occurred.
  21.  
  22.            LONGA    OFF             ;PREPARE ASSEMBLER FOR EMULATION MODE
  23.            LONGI    OFF
  24.            65C02    ON
  25.            KEEP     SETDTR2
  26.            START
  27. SLOT       EQU      $01
  28.            SEC                      ;SET EMULATION MODE
  29.            XCE
  30.            JMP      BEGIN
  31. CMDLST     DC       H'03'           ;PARAMETER COUNT
  32.            DC       H'0B'           ;SETDTR COMMAND CODE
  33. RESLT      DC       I'0'            ;RESULT CODE (OUTPUT)
  34. DTRSTAT    DC       I'0'            ;BIT 7 IS STATE OF DTR (INPUT)
  35. BEGIN      LDA      #SLOT           ;COMPUTE $CN VALUE TO BE USED
  36.            ORA      #$C0
  37.            STA      OFFSET+2        ;MODIFY INSTRUCTIONS LOADING OFFSETS
  38.            STA      XOFFSET+2
  39.            STA      ICALL+2         ;MODIFY INSTRUCTIONS CALLING FIRMWARE
  40.            STA      XCALL+2
  41. IOFFSET    LDA      $C00D           ;THIS INSTRUCTION MODIFIED AT RUNTIME
  42.            STA      ICALL+1         ;MODIFY JSR TO INIT
  43. XOFFSET    LDA      $C012           ;THIS INSTRUCTION MODIFIED AT RUNTIME
  44.            STA      XCALL+1         ;MODIFY JSR TO EXTENDED SERIAL INTERFACE
  45. ICALL      JSR      $C000           ;THIS INSTRUCTION MODIFIED AT RUNTIME
  46.            LDA      #<CMDLST        ;LOW BYTE OF COMMAND LIST
  47.            LDX      #>CMDLST        ;HIGH BYTE OF COMMAND LIST
  48.            LDY      #0              ;24-BIT ADDRESS NOT USED BY 8-BIT PROGRAM
  49. XCALL      JSR      $C000           ;THIS INSTRUCTION MODIFIED AT RUNTIME
  50.            LDA      RESLT           ;DID AN ERROR OCCUR?
  51.            BNE      ERROR           ;YES- HANDLE THE ERROR
  52.            ...
  53. ERROR    
  54.            ...
  55.            END